package com.lkm.app_ui.ui.sale.p;

import com.lkm.app_ui.ui.sale.SaleContract;
import com.lkm.frame.util.CycleHelp;
import com.lkm.mvp.FullLifecycleObserverAdapter;

import androidx.fragment.app.Fragment;



public class Pfactory {
    public static SaleContract.Presenter getPresenter(CycleHelp cycleHelp){
        return new SalePresenter(cycleHelp);
    }
    public static SubtotalPresenter getSubtotalPresenter(SaleContract.Presenter presenter,Fragment fragment) {

        SubtotalPresenter subtotalPresenter = ((SalePresenter)presenter).getSubtotalPresenter();
        fragment.getLifecycle().addObserver(new FullLifecycleObserverAdapter(subtotalPresenter));

        return subtotalPresenter;
    }

    public static GoodImagePresenter getGoodImagePresenter(SaleContract.Presenter presenter,Fragment fragment) {
        GoodImagePresenter goodImagePresenter = ((SalePresenter)presenter).getGoodImagePresenter();
        fragment.getLifecycle().addObserver(new FullLifecycleObserverAdapter(goodImagePresenter));
        return goodImagePresenter;
    }
}
